package com.feihao.zhou.demo01_Thread;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class CollectionTest {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("大王");
        collection.add("dd");
        collection.add("aa");
        collection.add("eeeee");

        //获取迭代器：
        Iterator<String> iterator = collection.iterator();

        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

        System.out.println("=============");

        collection.forEach((String s)-> System.out.println(s));

        for (String s : collection) {
            System.out.println(s);
        }


        ArrayList<String> list = new ArrayList<>();
        list.add("ddd");
        list.add("ww");
        list.add("ee");
        boolean b = collection.addAll(list);
        System.out.println(b);

        System.out.println(collection);
        List.of();

//        Object

    }
}
